import argparse
import os
from feature_extractor import FeatureExtractor

def main():
    parser = argparse.ArgumentParser(description='Extract features from audio file for music visualization')
    parser.add_argument('audio_path', type=str, help='Path to the audio file (MP3 or WAV)')
    
    args = parser.parse_args()
    
    # Check if file exists
    if not os.path.exists(args.audio_path):
        print(f"Error: File '{args.audio_path}' does not exist.")
        return
    
    # Check if file is an supported audio format
    if not (args.audio_path.lower().endswith('.mp3') or args.audio_path.lower().endswith('.wav')):
        print(f"Error: File '{args.audio_path}' is not a supported audio file (MP3 or WAV).")
        return
    
    print(f"Processing file: {args.audio_path}")
    
    # Extract features
    extractor = FeatureExtractor()
    extractor.extract_features(args.audio_path)

if __name__ == "__main__":
    main()